<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">
    	{notempty name='vo.id'}
    	<div class="layui-form-item">
            <label class="layui-form-label label-required">登录账号</label>
            <div class="layui-input-block">              
                <input disabled value='{$vo.username|default=""}' class="layui-input layui-bg-gray">
                <p class="color-desc">登录账号创建后，不允许再次修改。</p>
            </div>
        </div>
    	{/notempty}
        <div class="layui-form-item">
            <label class="layui-form-label label-required">用户姓名</label>
            <div class="layui-input-block">
                <input name="nickname" value='{$vo.nickname|default=""}' required pattern="^.{2,}$" placeholder="请输入2位及以上字符" class="layui-input">
                <!--<p class="color-desc">用户姓名创建后，不允许再次修改。</p>-->
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系手机</label>
            <div class="layui-input-block">
                <input type="tel" maxlength="11" autocomplete="off" autofocus name="phone" value='{$vo.phone|default=""}' pattern="^1[3-9][0-9]{9}$" placeholder="请输入联系手机" class="layui-input">
                <p class="color-desc">可选，用户联系手机号码，需要填写正确的格式</p>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系QQ</label>
            <div class="layui-input-block">
                <input name="qq" autocomplete="off"  value='{$vo.qq|default=""}' placeholder="请输入联系QQ" class="layui-input">
                <p class="color-desc">可选，用户联系QQ，需要填写正确的格式</p>
            </div>
        </div>
        {empty name='vo.id'}
        <div class="layui-form-item">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-block">
  			<!--{foreach $dep_op as $k=>$v}
            <label class="think-radio">
                {if (!isset($vo.department_id) and $v eq reset($dep_op)) or (isset($vo.department_id) and $vo.department_id eq $k)}
                <input type="radio" checked name="department_id" value="{$k}" lay-ignore> {$v}
                {else}
                <input type="radio" name="department_id" value="{$k}" lay-ignore> {$v}
                {/if}
            </label>
            {/foreach} -->
            
            <select class="layui-select" name="department_id">
                {foreach $dep_op as $k=>$v}
                {if (!isset($vo.department_id) and $v eq reset($dep_op)) or (isset($vo.department_id) and $vo.department_id eq $k)}
                <option selected value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                {/foreach}
            </select>
            </div>
        </div>
        {/empty}
        {notempty name='authorizes'}
        <div class="layui-form-item">
            <label class="layui-form-label">职位名称</label>
            <div class="layui-input-block">
                {if isset($vo.username) and $vo.username eq 'admin'}
                <span class="color-desc" style="line-height:36px">超级用户不需要配置权限</span>
                {else}
                <select class="layui-select" name="authorize[]">
                	{foreach $authorizes as $authorize}
                	{if in_array($authorize.id, $vo.authorize)}
                	<option selected value="{$authorize.id}">{$authorize.title}</option>
                	{else}
                	<option value="{$authorize.id}">{$authorize.title}</option>
                	{/if}
                	{/foreach}
                </select>
                
                <!--{foreach $authorizes as $authorize}
                <label class="think-radio">
                    {if in_array($authorize.id, $vo.authorize)}
                    <input type="radio" checked name="authorize[]" value="{$authorize.id}" lay-ignore> {$authorize.title}
                    {else}
                    <input type="radio" name="authorize[]" value="{$authorize.id}" lay-ignore> {$authorize.title}
                    {/if}
                </label>
                {/foreach}-->
                {empty name='authorizes'}<span class="color-desc" style="line-height:36px">未配置权限</span>{/empty}
                {/if}
            </div>
        </div>
        
        {/notempty}
        <div class="layui-form-item">
            <label class="layui-form-label">用户描述</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入用户描述" class="layui-textarea" name="desc">{$vo.desc|default=""}</textarea>
            </div>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
        <button class="layui-btn" type='submit'>保存</button>
        <button class="layui-btn layui-btn-danger" type='button'  data-close>取消</button>
    </div>
    <script>window.form.render();</script>
</form>
